﻿@using YanForum.Engine.ViewModels
@model UserIndex


@{
    ViewBag.Title = "Quản lý tài khoản";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}

@Html.Partial("_partialSearch",Model.Options)

<div class="row">
    <div class="col-md-12">    
            <table class="table table-bordered table-hover">
                <thead>
                    <tr>
                        <th>UserName</th>
                        <th>Email</th>
                        <th>FullName</th>
                        <th>Role</th>
                        <th style="width: 100px;">CreateDate</th>
                        <th style="width: 80px;">Action</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var item in Model.ListUser)
                    {
                        <tr>
                            <td>@item.UserName</td>
                            <td>@item.Email</td>
                            <td>@item.FullName</td>
                            <td>@item.RoleName</td>
                            <td>@string.Format("{0: dd/MM/yyyy}",item.CrateDate)</td>
                            <td>
                                @{
                                    var membership = (WebMatrix.WebData.SimpleMembershipProvider)Membership.Provider;
                                    int idUser = membership.GetUserId(User.Identity.Name);
                                }
                                @if (item.UserId != idUser)
                                {
                                    <a href="javascript:;" data-userid="@item.UserId" id="btnUserDelete" class="i-action btnUserDelete" title="Banned tài khoản"><i class="glyphicon glyphicon-remove"></i></a>
                                    <a href="@Url.Action("SetPassWord", "AccountAdmin", new { area = "Admin", id = item.UserId})" class="i-action" title="Thay đổi mật khẩu"><i class="glyphicon glyphicon-pencil"></i></a>
                                }else{
                                    <a href="javascript:;" class="i-action">&nbsp;&nbsp;&nbsp;</a>
                                    <a href="javascript:;" class="i-action">&nbsp;&nbsp;&nbsp;</a>
                                }
                                
                            </td>
                        </tr>
                    }
                </tbody>
            </table>
            @if (Model.TotalCount > Model.ListUser.Count)
            {
                string url = Url.Action("ManageAccount", "AccountAdmin", new { area = "Admin" });
                <div class="col-md-12 text-center">
                    <nav>
                        @{Html.RenderAction("Pagging", "Partial", new { area = "", linktext = url + "?roleid=" + Model.Options.RoleId + "&search=" + Model.Options.Search, totalCount = Model.TotalCount, pageSize = Model.PageSize, pageIndex = Model.PageIndex });}
                    </nav>
                </div>
            }
    </div>
</div>